package org.nanquan.dotjava.util;


import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;

public class BaseSerialization implements Serializable {
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3423548967752917247L;
	String username;
	
	HashMap<String,Serializable> hm=new HashMap<String, Serializable>();
	
	public static void main(String[] args) {
		
		BaseSerialization b=new BaseSerialization();
		b.username="fdfgdfgfdnvbnhgng广泛的规范的";
		b.hm.put("yahoo", "雅 虎");
		b.hm.put("sina", "新浪");
		
		SerializationObject se=new SerializationObject();
		try {
			@SuppressWarnings("unused")
			String cs = se.saveObjectToString(b);
			byte [] bytes=se.saveObject(b);
			try {

				String string = ConvertUtil.bytesToHexString(bytes);
				System.out.println(string);
				byte [] convered=ConvertUtil.hexStringToByte(string);
//				System.out.println(cs);
				BaseSerialization newb=(BaseSerialization) se.getObject(convered);
				System.out.println(newb.username);
				
			} catch (Exception e) {
				// TODO 自动生成 catch 块
				e.printStackTrace();
			}
		} catch (IOException e) {
			// TODO 自动生成 catch 块
			e.printStackTrace();
		}
	}

}
